namespace OracleInternal.SqlAndPlsqlParser.LocalParsing
{
	public class OracleLpTextFragment
	{
		protected string m_vReferenceText;

		protected string m_vFragment;

		protected int m_vLength;

		protected int m_vStart;

		public virtual OracleLpTextFragment RelativeFragment => null;

		public string ReferenceText => m_vReferenceText;

		public string Fragment
		{
			get
			{
				if (m_vFragment == null)
				{
					m_vFragment = m_vReferenceText.Substring(Start, m_vLength);
				}
				return m_vFragment;
			}
		}

		public int Length => m_vLength;

		public virtual int Start => m_vStart;

		public virtual int RelativeStart => m_vStart;

		internal OracleLpTextFragment(string text, int start, int length)
		{
			m_vReferenceText = text;
			m_vStart = start;
			m_vLength = length;
		}

		internal OracleLpRelativeTextFragment GetRelativeTextFragment(int absoluteStart, int length)
		{
			return new OracleLpRelativeTextFragment(this, absoluteStart - Start, length);
		}

		internal OracleLpTextFragment GetAbsoluteTextFragment(int relativeStart, int length)
		{
			return new OracleLpTextFragment(m_vReferenceText, relativeStart + Start, length);
		}

		public override string ToString()
		{
			return Fragment;
		}
	}
}
